<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<c:import url="../cabecalho.jsp" />
<c:import url="../menu.jsp" />
<div class="col-sm-9 col-sm-offset-3 col-lg-10 col-lg-offset-2 main">
	<div class="row">
		<ol class="breadcrumb">
			<li>
				<a href="#">
					<span class="glyphicon glyphicon-home"></span>
				</a>
			</li>
			<li class="active">
				<fmt:message key="consulta.reparos" />
			</li>
		</ol>
	</div>
	<div class="row">
		<div class="col-lg-12">
			<h1 class="page-header">
				<fmt:message key="consulta.reparos" />
			</h1>
		</div>
	</div>
	<form:form action="buscarReparos" commandName="filtroReparoOem">
		<div class="row">
			<div class="col-lg-10 col-md-10">
				<div class="panel panel-default">
					<c:if test="${not empty msg && msg.tipo eq 'sucesso'}">
						<div class="alert alert-success" role="alert">
							<fmt:message key="${msg.texto}" />
						</div>
					</c:if>
					<c:if test="${not empty msg && msg.tipo eq 'erro'}">
						<div class="alert alert-danger" role="alert">
							<b>
								<fmt:message key="${msg.texto}">
									<br>
								</fmt:message>
							</b>
						</div>
					</c:if>
					<div class="panel-heading cab">
						<fmt:message key="filtrodedados" />
					</div>
					<div class="panel-body">
						<div class="col-md-12 col-lg-12">
							<div class="form-group col-md-3 col-lg-3">
								<form:label path="entradaDeReparoDe">
									<fmt:message key="consulta.reparos.entradareparode" />
								</form:label>
								<form:input path="entradaDeReparoDe" cssClass="form-control datepicker"/>
							</div>
							<div class="form-group col-md-3 col-lg-3">
								<form:label path="entradaDeReparoAte">
									<fmt:message key="consulta.reparos.entradareparoate" />
								</form:label>
								<form:input path="entradaDeReparoAte" cssClass="form-control datepicker"/>
							</div>
							<div class="form-group col-md-3 col-lg-3">
								<form:label path="modelo">
									<fmt:message key="modelo" />
								</form:label>
								<form:select path="modelo" cssClass="form-control">
									<form:option path="modelo" value=""></form:option>
									<c:forEach items="${dadosBasicos}" var="dadoBasico">
										<form:option path="modelo" value="${dadoBasico.modelo}">${dadoBasico.modelo}</form:option>
									</c:forEach>
								</form:select>
							</div>
							<div class="form-group col-md-3 col-lg-3">
								<form:label path="numeroSerie">
									<fmt:message key="numeroserie" />
								</form:label>
								<form:input path="numeroSerie" cssClass="form-control"/>
							</div>
						</div>
						<div class="col-md-12 col-lg-12">
							<div class="form-group col-md-3 col-lg-3">
								<form:label path="status">
									<fmt:message key="status" />
								</form:label>
								<form:select path="status" cssClass="form-control">
									<form:option path="status" value=""></form:option>
									<c:forEach items="${status}" var="st">
										<form:option path="status" value="${st}"><fmt:message key="${st.descricao}"/></form:option>
									</c:forEach>
								</form:select>
							</div>
							<div class="form-group col-md-3 col-lg-3">
								<form:label path="numeroReparo">
									<fmt:message key="numeroreparo" />
								</form:label>
								<form:input path="numeroReparo" cssClass="form-control"/>
							</div>
							<div class="form-group col-md-3 col-lg-3">
								<form:label path="ordemServico">
									<fmt:message key="ordemservico" />
								</form:label>
								<form:input path="ordemServico" cssClass="form-control"/>
							</div>
						</div>
						<div class="col-md-12 col-lg-12">
							<div class="form-group col-md-12 col-lg-12">
								<button type="submit" class="btn btn-primary direita">
									<fmt:message key="consultar" />
								</button>
							</div>
						</div>
					</div>
						
						
					<c:if test="${not empty reparoOem}">
						<div class="panel-heading cab">
							<fmt:message key="consulta" />
						</div>
						<div class="panel-body">
							<div class="col-lg-12">
								<table class="table table-hover">
									<thead>
										<tr>
											<th>
												<fmt:message key="status" />
											</th>
											<th>
												<fmt:message key="numeroreparo" />
											</th>
											<th>
												<fmt:message key="modelo" />
											</th>
											<th>
												<fmt:message key="numeroserie" />
											</th>
											<th>
												<fmt:message key="datacriacao" />
											</th>
											<th>
												<fmt:message key="alterar" />
											</th>
										</tr>
									</thead>
									<c:forEach items="${reparoOem}" var="reparoOem">
										<tr>
											<td><fmt:message key="${reparoOem.status.descricao}"/></td>
											<td>${reparoOem.id}</td>
											<td>${reparoOem.produto.dadosBasicos.modelo}</td>
											<td>${reparoOem.produto.numeroDeSerie}</td>
											<td><fmt:formatDate value="${reparoOem.dataDeCriacao.time}" pattern="dd/MM/yyyy" /></td>
											<td>
												<a href="editarReparo?id=${reparoOem.id}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a>
											</td>
										</tr>
									</c:forEach>
								</table>
							</div>
						</div>
					</c:if>
				</div>
			</div>
		</div>
		<input type="hidden" name="temErroForm" id="temErroForm" value="${not empty msg && msg.tipo eq 'erro' ? 'sim' : 'nao'}" />
	</form:form>
</div>
<c:import url="../rodape.jsp" />
